//Stephen Kirksharian
//Robert Harkreader
//CPSC 321
//DUE 4/27/08

//Main control

`include "ALU_op.v"
`include "ALU_lcl_ctr.v"
`include "MemtoReg_ctr.v"
`include "RegWriteEn_ctr.v"
`include "branch_ctr.v"
`include "jump_ctr.v"
`include "memWrite_ctr.v"
`include "regDest.v"
`include "sgn_ext_ctr.v"
`include "word_byte_ctr.v"
`include "jump_register_ctr.v"
`include "ALUsrc_ctr.v"
`include "shift_ctr.v"
`include "MemRead_ctr.v"
module main_ctr(opcodes,funct,MemtoReg_out,RegWriteEn_out,jump_out,memWrite_out,sgn_ext_out,word_byte_out,branch_out,regDest,toALU,jump_register_out,ALUsrc_out,shift_out,MemRead_out);

	input [5:0]opcodes,funct;
	wire [3:0]ALUop_out;
	output [2:0]MemtoReg_out;
	output MemRead_out,RegWriteEn_out,jump_out,jump_register_out,memWrite_out,sgn_ext_out,word_byte_out,ALUsrc_out;
	output [1:0]branch_out,regDest,shift_out;
	output [3:0]toALU;
	wire tempReg;

	
	  
	MemRead_ctr Hubbba(opcodes,MemRead_out);
	ALUop A(opcodes,ALUop_out);
	MemtoReg_ctr B(opcodes,funct,MemtoReg_out);
	RegWriteEn_ctr C(opcodes,funct,RegWriteEn_out);
	branch_ctr D(opcodes,branch_out);
	jump_ctr E(opcodes,jump_out);
	memWrite_ctr F(opcodes,memWrite_out);
	regDest G(opcodes,regDest);
	sign_control H(funct,opcodes,sgn_ext_out);
	word_byte_ctr I(opcodes,word_byte_out);
	ALU_lcl_ctr(funct,ALUop_out,toALU);
	jump_register_ctr(opcodes,funct,jump_register_out);
	ALUsrc_ctr(opcodes,ALUsrc_out);
	shift_ctr(opcodes,funct,shift_out);

specify
	(opcodes *> jump_out)=(20:20:20);
	(opcodes *> MemtoReg_out)=(20:20:20);
	(opcodes *>MemRead_out)=(20:20:20);
	(opcodes *>ALUop_out)=(20:20:20);
	(opcodes *>RegWriteEn_out)=(20:20:20);
	(opcodes *>branch_out)=(20:20:20);
	(opcodes *>memWrite_out)=(20:20:20);
	(opcodes *>regDest)=(20:20:20);
	(opcodes *>sgn_ext_out)=(20:20:20);
	(opcodes *>word_byte_out)=(20:20:20);
	(opcodes *>jump_register_out)=(20:20:20);
	(opcodes *>ALUsrc_out)=(20:20:20);
	(opcodes *>shift_out)=(20:20:20);
endspecify

endmodule